package com.tangruojie.stream;

import com.tangruojie.entity.Author;

import java.util.List;

/**
 * 终结操作
 * anyMatch     是否有任意一个元素满足条件
 * allMatch     是否所有元素都满足条件
 * noneMatch    是否所有元素都不满足条件
 */
public class StreamDemo13 {

    public static void main(String[] args) {

        List<Author> authors = StreamDemoTest.getAuthors();

        /**
         * anyMatch
         */
        boolean a = authors.stream().anyMatch(author -> author.getAge() > 100);
        System.out.println(a);

        /**
         * allMatch
         */
        boolean b = authors.stream().allMatch(author -> author.getAge() >= 18);
        System.out.println(b);

        /**
         * noneMatch
         */
        boolean c = authors.stream().noneMatch(author -> author.getAge() > 100);
        System.out.println(c);

    }

}
